#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os

from flask import current_app
from flask_script import Manager, Shell

from blog import create_app
from blog.extenstion import db
from blog.user.Models import User

__author__ = 'Tim Yao'
app = create_app(os.getenv('FLASK_CONFIG') or 'default')


manager = Manager(create_app)


@manager.shell
def make_shell_context():
    return dict(app=current_app,
                db=db,
                User=User)


manager.add_option('-c', '--config',
                   dest="config",
                   required=False,
                   help="config file")

if __name__ == '__main__':
    manager.run()
